package com.lingsui.mode.strategy;

/**
 * User: caoping
 * Date: 2018/9/2 上午9:37
 */
public abstract class Duck {


    FlyBehavior flyBehavior;

    QuackBehavior quackBehavior;


    public Duck() {
    }

    public void swim(){
        System.out.println("All ducks float,even decoys ");
    }


    public abstract void display();


    public void performFly(){
        flyBehavior.fly();
    }

    public void performQuack(){
        quackBehavior.quack();
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }
}
